package softtest4;


import java.time.Duration;
import java.time.ZonedDateTime;

public class Bill2 {
    public   long calculateTimeSpan(String startTime, String endTime){
        ZonedDateTime time1 = ZonedDateTime.parse(startTime);
        ZonedDateTime time2 = ZonedDateTime.parse(endTime);
        time2 = time2.withLaterOffsetAtOverlap();
        Duration duration = Duration.between(time1, time2);

        long minutes = duration.getSeconds() / 60;
        if (duration.getSeconds() % 60 > 0) {
            minutes++;
        }





        return minutes;
    }



    //计算价格
    public double countMoney(long time){
        double money = 0;
        if(time <= 0|| time >1800){
            money = -1.0;
        }
        else if(time > 0 && time <=20){
            money = time*0.05;
        }

        else
            money = 1+(time - 20)*0.1;

        return money;
    }




}
